#include "led.h"
#include "serial.h"
#include "system_timer.h"
#include "interrupt_handler.h"
#include "lib.h"
#include "asmcode.h"

//------------------------------------------------------------------------------
void start(){
    remap();
    init_yellow_led();
    init_red_led();
    init_green_led();
    //Bootsequenz
    switch_yellow_led_on();
    switch_red_led_on();
    switch_green_led_on();

    write("Willkommen bei Melvin Calvin 0.9801.\n Wenn Sie es Nernst meinen, fahren Sie fort:\n");
    

    
    write("Interrupts im AIC enabeln ... ");
    enableAICInterrupts();
    write("Interrupts im AIC (hoffentlich) enabelt.\n");
    
    write("Periodische Interrupts initialisieren ... ");
    initPeriodicInterrupts();
    write("Periodische Interrupts (hoffentlich) initialisiert.\n");
    
    busywait(100000);
    
    while(1){
	
      if(*ST_SR){
	switch_yellow_led_off();
	busywait(100000);
	switch_yellow_led_on();
      }
	write("A");
      busywait(10000);
    }
}
//------------------------------------------------------------------------------


